package net.acoinWork.dynRender.configParse.xmlModel;

import org.jdom2.Element;
import org.jdom2.Namespace;

/**
 * @author xusk
 * @Date: 15/12/31 上午11:16
 */
public final class Command implements XmlEleAssembly {
    private String id;
    private Description description;
    private PreRender preRender;

    public String getId() {
        return id;
    }

    public Description getDescription() {
        return description;
    }

    public PreRender getPreRender() {
        return preRender;
    }

    @Override
    public void assemble(Element element, Namespace namespace) {
        this.id = element.getAttribute("id").getValue();
        this.description = new Description();
        this.description.assemble(element.getChild("description", namespace), namespace);
        this.preRender = new PreRender();
        this.preRender.assemble(element.getChild("pre-render", namespace), namespace);
    }

    @Override
    public String toString() {
        return "Command{" +
                "id='" + id + '\'' +
                ", description=" + description +
                ", preRender=" + preRender +
                '}';
    }
}
